/**
 * Created by zhaizy on 2015/3/10.
 */

angular.module("mydirective", [])

    .directive("zzbLabel", function () {
        return {
            restrict: "EA",
            templateUrl: "templates/component/zzbLabel.html",
            scope: {
                title: '@',
                value: '@'
            }
            //controller: function ($scope, $ionicPopup, zzbLocalCache,$timeout) {
            //
            //    //evCache.put("net","http://zzb.baoxan.net/cpmap/access/");
            //    //evCache.put("org","http://zzb.baoxan.org/cpmap/access/");
            //    //evCache.put("come","http://zzb.baoxian.com/cpmap/access/");
            //    //evCache.put("52zzb","http://zzb.52zzb.com/cpmap/access/");
            //
            //
            //
            //}
        }
    })

    .directive('myTestDirective', function () {
        return {
            restrict: 'A',
            template: 'Inside myDirective, isolate scope: {{ myProperty }}',
            scope: false
        };
    })
    .directive('myInheritScopeDirective', function () {
        return {
            restrict: 'A',
            template: 'Inside myDirective, isolate scope: {{ myProperty }}',
            scope: {}
        };
    })

    .directive('sidebox', function () {
        return {
            restrict: 'EA',
            scope: {
                title: '@'
            },
            transclude: true,
            template: '<div class="sidebox">\
                         <div class="content">\
                         <h2 class="header">{{ title }}</h2>\
                         <span class="content" ng-transclude>\
                         </span>\
                       </div>\
                     </div>',
            controller: function ($scope, $element, $transclude, $log) {

                console.log("@@##directive controller!");
                $transclude(function (clone) {
                    var a = angular.element('<a>');
                    a.attr('href', clone.text());
                    a.text(clone.text());
                    $log.info("Created new a tag in link directive");
                    $element.append(a);
                });


            }
        };
    });